home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / yearcalc.zip / YEARCAL.DOC < prev    next >
Text File  |  1987-12-02  |  14KB  |  275 lines

  1. /***************************************************************/
  2.                 YEARCAL v0.04T 2 Nov 1987
  3.  
  4.         Copyright 1987 by Paul M. Sittler
  5.  
  6. YEARCAL makes calendars (A) and schedules (M/W/D) for years after 1901.
  7.  
  8. At the user's option, Normal, Fiscal Year, AGGIE, or 3-Digit Julian
  9. Date Calendars can be produced, in multiple copies, for a number of
  10. consecutive years, or both.  Fiscal Year calendars may be produced for
  11. any arbitrary 12 or 13 month fiscal year.  The user may select a
  12. Programmer's calendar, numbered in Hexadecimal or Octal numbers rather
  13. than decimal numbers, and may choose one of several languages.
  14.  
  15. The calendars may be displayed on the screen, printed, or written to
  16. a file as desired.  If written to disk, files are named like YYYY.ENG
  17. (Normal ENGlish), YYYYFY.DUT (Fiscal-Year DUTch), YYYYAGG.TEX (Aggie-
  18. type TEXan), or YYYYJUL.POL (3-Digit Julian Date POLish) calendars,
  19. etc.  Hex or Octal calendar files will have an "H" or "O" added to
  20. their names, such as YYYYH.SPA, YYYYFYO.SER or YYYYAGGH.FRE.
  21.  
  22. YEARCAL may be freely distributed, and used for non-commercial
  23. purposes, as long as the unmodified program source code and
  24. documentation files are distributed with it.
  25.  
  26. /***************************************************************/
  27.  
  28. Brief History:  Why (and much of How) YEARCAL came to be. . .
  29.  
  30. A fellow at the office asked if I could get him a calendar for
  31. 1989, as his desk calendar only went to 1988.  I grabbed a
  32. program that I had lying around, and did it.  I also went onto
  33. GENie and found a program there that did the same job.  Both of
  34. these programs were written in BASIC, and when interpreted ran
  35. slowly.  When compiled they took up 45-50 Kbytes or so.  I
  36. thought I might be able to make one a little smaller, faster,
  37. and with a few more useful features.
  38.  
  39. Along the way, I discovered that 2000 will really be a leap
  40. year, while 1900 was not, and that the year 4000 will be weird
  41. too.  I also remembered a way of making an AGGIE calendar that
  42. has the information arranged a little differently, and added
  43. that capability to it as well.  I decided that one could
  44. logically wish to view a calendar on a screen, print a calendar
  45. on a printer, or write the calendar to a file.  It seemed useful
  46. to make runs of multiple years or copies, so it can do both.
  47.  
  48. Then, Chris Lang suggested that it would really be neat to have
  49. a program that produced fiscal year calendars.  YEARCAL will now
  50. produce fiscal year calendars for an arbitrary 12 full-month
  51. fiscal year.  Rich Hedges suggested that it would really be neat
  52. to produce a fiscal year calendar for a fiscal year that begins
  53. on a weird date, like July 15th.  .  .  Well, not yet, and maybe
  54. never .  .  .
  55.  
  56. Turned out that adding code to accommodate 13 month arbitrary
  57. starting dates was not all that difficult.  .  .  So now it does
  58. that as well.
  59.  
  60. Then, Dale Schafer pointed out that on his IBM token ring
  61. network setup, a banner and a blank page were being printed
  62. between each successive calendar.  This was because I was
  63. skillfully closing the file (PRN, CON, etc.) after every
  64. calendar was written.  Hmmmm.  .  .  Also fairly easy to fix,
  65. but required a little bit of rethinking.
  66.  
  67. I confess.  There was an undocumented feature in version 0.01c
  68. or 0.01d that allowed the "JANUARY" month of a fiscal year to be
  69. printed as "SUNDAY", and then "FEBRUARY" as "TUESDAY".  Further,
  70. Not everyone has or uses DeSmet C.  .  .  I converted YEARCAL to
  71. Borland's Turbo-C, and that wee beastie has been put to bed.
  72. Damn those entomological cybernoids!!
  73.  
  74. A super serious individual (who shall remain nameless) asked me
  75. what the AGGIE calendar was good for.  I have been using it for
  76. some time time to keep up with meeting dates that occur more or
  77. less by formula.  You know, such things as "First Tuesday of
  78. every month at 7:30 pm" and the like.  No sense of humour.  .  .
  79.  
  80. Then, one night an old CP/M-hacking KayPro user (Don Buzzingham)
  81. happened by, and after one too many cups of coffee, we were
  82. inspired to do a "Programmer's" calendar.  Where is it written
  83. that a calendar must represent the dates with decimal numbers?
  84. Why not Hexadecimal, or (for us real fossils) Octal? Why not
  85. Binary? (Answer: binary representations won't fit easily and
  86. neatly on the screen.  .  .  ) Why not any arbitrary number
  87. base?  (Gag me with a spoon, Adolph!)  (Answer: unless the number
  88. base is larger than base 4, the dates won't fit nicely either.)
  89. In keeping with the concept of following the path of least
  90. resistance, I took the easy way out, and added the capability of
  91. doing Hex and Octal calendars too.
  92.  
  93. Why not have it produce calendars in a number of different
  94. languages?  (Do you know how many languages exist?) So, language
  95. support for sixteen different languages was added.  This
  96. created some problems with the limitations of the IBM(tm)
  97. character set that came stock with my computer.  Not all of the
  98. requisite special characters are there.  When I used the cute
  99. special characters, and sent them to several different printers,
  100. each printer decided to react to them in different ways, and
  101. usually NOT by printing the special character I had intended.
  102. Alas, proper use of the international characters is not to be,
  103. at least not yet.  .  .  I apologise in advance to all of those
  104. who care, and ask your indulgence.  I did try.  .  .
  105.  
  106. I dropped Greek and Russian because of the character set
  107. problem, and have made no attempt at adding any oriental
  108. languages for the same reason.  (I have been tempted to add
  109. Korean, using the McKune-Reischauer Romanisation scheme.  Let me
  110. know if anyone cares.)  Added Afrikaans at the suggestion of a
  111. friend.  .  .  Finally did add Korean (Romanised).  .  .
  112.  
  113. I woke up late one night with a memory of another calendar
  114. hassle that I had experienced while in the forced employ of the
  115. Army.  The DOD and GAO find it useful to think of dates as mere
  116. numbers.  The so-called Julian-Date scheme is used there.  It
  117. basically takes note of the fact that there are either 365 or
  118. 366 days in the Gregorian calendar year, and numbers a date by
  119. its relative position in the year.  Thus, January 1 would be
  120. 001, and December 31st might be either 365 or 366.  This is
  121. referred to as a 3-digit Julian Date, and is mighty useful if
  122. you know what year it is.  It makes it really simple to find out
  123. how many days there are between dates, so you can find out how
  124. long your most important requisition has been backordered (also
  125. known as "Lost in the System").  For greater specificity, the
  126. Four-Digit, Five-Digit, Six-Digit, and Seven-Digit Julian Dates
  127. can be made by adding more or less of the year in front of the
  128. date.  February 29th, 1988 might be shown as 1988059 as a
  129. Seven-Digit Julian Date, and as 8059 for a Four-Digit Julian
  130. Date.
  131.  
  132. GAO even puts out a clever little form that supply types often
  133. refer to when they can't find their desk calendars.  Made of
  134. heavy card-stock, it is called a "Perpetual Julian Date
  135. Calendar".  There are basically only two types of Julian Date
  136. Calendars, one for Leap Years and one for Non-Leap Years.  The
  137. hassle I had was that in the field we usually didn't have our
  138. desk calendars, and sometimes (usually) couldn't find our GAO
  139. cheat sheets.  Since no well-equipped armed force would dream of
  140. trying to operate without its computer(s), I added the
  141. capability to produce 3-Digit Julian Date calendars as well in
  142. decimal, hexadecimal, and octal numbering systems.  .  .  If you
  143. don't ordinarily take your computer(s) to the field, you have
  144. the option of printing them out on paper.
  145.  
  146. I guess it had to happen.  If you solicit suggestions for
  147. enhancement, bug reports, and sound as if you are sincere,
  148. someone may take you up on it.  I received a Fido Message from
  149. Jim Gibbs of KIVY AM/FM in Crockett, TX.  suggesting that maybe
  150. I could modify it to do a "Broadcast" or "Advertising" calendar.
  151. Seems like all of the months in those industries begin on a
  152. Sunday.  If I only had a sample.  .  .
  153.  
  154. Another Fido E-Mail message suggested that it would be nice if
  155. it would make Annual, Monthly, and Weekly calendars.  I got to
  156. thinking about that and decided that the Weekly and Daily
  157. Schedules would be helpful for time management, and that perhaps
  158. a monthly calendar would be pretty easy to do too.  I guess that
  159. most businesses have stopped giving them out at Christmas
  160. lately.  So, the ability to do Monthly calendars and Weekly and
  161. Daily schedules was added.  I decided that the schedules should
  162. be allowed to start on any given day, as some people like to
  163. start their weeks on Tuesday, or Thursday.  This will probably
  164. help in the Broadcast or Advertising week thing, as you may
  165. specify that the schedules will start on a Monday.  (More later
  166. for you, Jim.  .  . )  Chris Lang suggested that the ability to
  167. add user-specified title lines would be helpful, so that he could
  168. make his very own "Wildlife and Fisheries Science Department"
  169. "Monthly Vehicle Use Projection" type calendars.  I pointed out
  170. that he could simply edit the files that it could produce, but
  171. he said that I didn't have to put up with the whining of his
  172. office staff.  I quickly added that capability as well.
  173.  
  174. Someone wanted it to do a Hebrew calendar, someone (else) an
  175. Islamic calendar (for equal time); a Lunar calendar, a Mayan
  176. calendar, a Babylonian calendar, .  .  .  I intend to contact
  177. the local neighborhood rabbi, (I know, things I should have
  178. learned in Schul).  I am even interested in a rumoured scheme
  179. for a thirteen-month calendar.  .  .  I had never realised how
  180. many ways there are for abstracting the same natural phenomenon
  181. (turn, turn, turn.  .  .).  (Let's hear it for them
  182. Byrd-brains!).
  183.  
  184. Why not have the first screen ask which language to use in all
  185. supported languages? Then you could have instructions and
  186. prompts written in whatever language was selected.  .  .  Alas,
  187. I am not up to that linguistically.  Would need a little help
  188. from all of you out there in the world.  .  .  And that would
  189. make the program grow somewhat.  .  .  (Jiminy!! It's already up
  190. to 26 Kbytes, and runs slightly slower than it used to.  .  .).
  191.  
  192. Lately I have been dreaming about a "Random" calendar.  As I
  193. envision it, the months would be scrambled, and the days of the
  194. week would be scrambled randomly, but have the right dates under
  195. them.  .  .  How many possible permutations.  .  .
  196.  
  197. Here is YEARCAL.  Enjoy it, and remember, the AGGIE calendar
  198. really does have a useful purpose.  I use it to help schedule
  199. meetings of the type of "First Tuesday Monthly" and that sort of
  200. thing.  The code is over commented by most 'c' programmer's
  201. standards.  I do that so that I can fix it easily three months
  202. later.  Plus, my mother was frightened by an assembler while
  203. carrying me.  By special request, for those purists out there, I
  204. can supply a version of the source that is devoid of white space
  205. that has all variable names shortened to two uppercase
  206. characters.
  207.  
  208. There are some really cute functions there that may be useful
  209. for learning tools.  For example, I know of no way to more
  210. efficiently determine whether or not a year is leap year than
  211. the cute little sieve that I wrote.  (Sin of pride).
  212.  
  213. By the way, the good news is that:
  214.  
  215. The CP/M version is due out "Real Soon Now".  .  .  according to
  216. Jerry P., who writes a lot of very good fiction.
  217.  
  218. /***************************************************************/
  219.  
  220. Limitations:
  221.  
  222. 1) Date must be after 1901 and before 4000.  I understand that
  223.    there will be an adjustment of some kind in 4000, but am not
  224.    sure what it is to be.  Anyway, it will be after my shift. . .
  225.  
  226. 2) Assumes 80 column screen, and uses the DOS calls to do screen
  227.    I/O, thus there is no colour, no graphics, and it is s l o w.
  228.    However, it will therefor work on almost all MSDOS machines.
  229.  
  230. 3) Assumes MSDOS for date/time interrupt 21 call to get the DOS
  231.    date.  Source code should port easily to any c compiler, for
  232.    CP/M machines, VAXen, and other dinosaurs...
  233.  
  234. 4) It assumes a printer that can print at least 85 columns.  The
  235.    scheduling options for Monthly, Weekly, and Daily schedules
  236.    will ask for the printer page length and page width values,
  237.    and adjust the output accordingly.
  238.  
  239. 5) It assumes that the printer can respond to a form-feed character.
  240.  
  241. 6) It does not do any neat double-wide, emphasized print, nor
  242.    does it make use of any graphics characters.  It just puts out
  243.    vanilla ASCII text.  To do so would be to try to figure out all
  244.    of the many printer codes and do an installation program or
  245.    another menu or something.
  246.  
  247. 7) It does not work from a command line.  It is interactive.
  248.  
  249. /***************************************************************/
  250. **  Copyright (c) 1987 by Paul M. Sittler.
  251. **  All rights reserved.  The copyright owner hereby authorizes the no-charge,
  252. **  noncommercial making and/or distribution of copies of the entirety of
  253. **  this work unchanged and unincorporated in any other work (except "LiBRary"
  254. **  or "ARChive" disk files for the sole purpose of no-charge noncommercial
  255. **  distribution).  No other reproduction or use is authorized without the
  256. **  express prior written consent of the copyright owner.
  257.  
  258. **  Once upon a time, in a kingdom far away, people shared source code and
  259. **  many of us benefited from the sharing.  This silly little program is here
  260. **  presented with source in hopes that it may stimulate the renewed sharing
  261. **  of our efforts.
  262.  
  263. **  I am open to comment, suggestions for enhancements, and bug
  264. **  reports.
  265.  
  266. **  Paul M. Sittler
  267. **  1106 Berkeley Drive
  268. **  College Station, TX 77840
  269.  
  270. **  Modem (409) 764-0056 300/1200/2400 baud 24 hours/day
  271. **  My Word #2 Fido 117/1
  272. **  GENie User mail address P.M.SITTLER
  273.  
  274. /***************************************************************/
  275.